The inferior gluteal nerve arises from the dorsal branches of the ventral rami of the L5, S1 and S2.  It leaves the pelvis through the greater sciatic foramen below piriformis.  It divides into branches, which enter gluteus maximus from its deep surface.

Supply
It supplies the gluteus maximus muscle.